You are here: Building the Model: Advanced Elements > Arrays > Initializing Arrays
By default, all cells in an array are initialized to zero. Initializing cells to some other value should be done in the initialization logic. A WHILE...DO loop is useful for initializing array cell values. The logic below fills a 3 x 5 array (3 rows and 5 columns) with values from an external, general read file.
This example uses the variables Column and Row (which may be defined as local variables) along with two WHILE...DO loops to assign every cell in the array Inventory_Array a value from a general inventory file. The logic first sets the value of the variable Column to one. It then assigns all the cells in column one a value by reading a value from the external file and incrementing the variable Row. When all the cells in column one have a value, the logic increments to the second column and does the inside loop again. It repeats this loop until each cell in the array has a value.
Please note
Assigning values to a cell in an array can be done in any expression or logic field, such as initialization and operation logic. See Execution Time of Initialization and Termination Logic for a list of logic elements used to define model parameters.